﻿@model IRIS.Models.EventCal

@{
    ViewBag.Title = "IRIS : Skrá atburð";
}


@section SubMenu
{
    <ul>
        <li>@Html.ActionLink("Janúar", "Date", "Events", new { theMonth = 1, theYear=DateTime.Now.Year , theMonthName = "Janúar" },null)</li>
        <li>@Html.ActionLink("Febrúar", "Date", "Events", new { theMonth = 2, theYear = DateTime.Now.Year, theMonthName = "Febrúar" }, null)</li>
        <li>@Html.ActionLink("Mars", "Date", "Events", new { theMonth = 3, theYear=DateTime.Now.Year , theMonthName = "Mars" },null)</li>
        <li>@Html.ActionLink("Apríl", "Date", "Events", new { theMonth = 4, theYear = DateTime.Now.Year, theMonthName = "Apríl" }, null)</li>
        <li>@Html.ActionLink("Maí", "Date", "Events", new { theMonth = 5, theYear = DateTime.Now.Year, theMonthName = "Maí" }, null)</li>
        <li>@Html.ActionLink("Júní", "Date", "Events", new { theMonth = 6, theYear = DateTime.Now.Year, theMonthName = "Júní" }, null)</li>
        <li>@Html.ActionLink("Júlí", "Date", "Events", new { theMonth = 7, theYear = DateTime.Now.Year, theMonthName = "Júlí" }, null)</li>
        <li>@Html.ActionLink("Ágúst", "Date", "Events", new { theMonth = 8, theYear = DateTime.Now.Year, theMonthName = "Ágúst" }, null)</li>
        <li>@Html.ActionLink("September", "Date", "Events", new { theMonth = 9, theYear = DateTime.Now.Year, theMonthName = "September" }, null)</li>
        <li>@Html.ActionLink("Október", "Date", "Events", new { theMonth = 10, theYear = DateTime.Now.Year, theMonthName = "Október" }, null)</li>
        <li>@Html.ActionLink("Nóvember", "Date", "Events", new { theMonth = 11, theYear = DateTime.Now.Year, theMonthName = "Nóvember" }, null)</li>
        <li>@Html.ActionLink("Desember", "Date", "Events", new { theMonth = 12, theYear=DateTime.Now.Year, theMonthName = "Desember" },null)</li>
    </ul>
}

<h2>Skrá atburð</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">
    function initialize() {
        var myLatlng = new google.maps.LatLng(64.135338, -21.895);
        var myOptions = {
            zoom: 12,
            center: myLatlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        }
        var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
        var marker = new google.maps.Marker({
            position: myLatlng,
            map: map,
            draggable: true,
            title: "Staðsetning á atburði"
        });

        google.maps.event.addListener(marker, 'position_changed', function (event) {
            var latlng = marker.getPosition();
            document.getElementById("lat").value = latlng.lat();
            document.getElementById("lng").value = latlng.lng();
        });
    }
    $(document).ready(function(){ 
    initialize();
    });
</script> 

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Upplýsingar um atburð</legend>

        <div class="editor-label">
            <label for="Title">Titill</label>
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Title)
            @Html.ValidationMessageFor(model => model.Title)
        </div>

        <div class="editor-label">
            <label for="EventDate">Hefst</label>
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EventDate)
            @Html.ValidationMessageFor(model => model.EventDate)
        </div>

       <div class="editor-label">
            <label for="EndDate">Lýkur</label>
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.EndDate)
            @Html.ValidationMessageFor(model => model.EndDate)
        </div>

        <div class="editor-label">
            <label for="Title">Lýsing</label>
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.Description)
            @Html.ValidationMessageFor(model => model.Description)
        </div>

        <div class="editor-label">
            <label for="Title">Staðsetning</label>
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Location)
            @Html.ValidationMessageFor(model => model.Location)
        </div>
        <div class="editor-label">
            Kort
        </div>
        <div id="map_canvas" style="width: 500px; height: 350px"></div>
            @Html.HiddenFor(model => model.lat)
            @Html.HiddenFor(model => model.lng)
        <p>
            <input type="submit" value="Skrá atburð" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
